3.5.64 \(\int \frac {(c+d \sin (e+f x))^2}{(3+3 \sin (e+f x))^2} \, dx\) [464]

3.5.64.1 Optimal result
3.5.64.2 Mathematica [B] (verified)
3.5.64.3 Rubi [A] (verified)
3.5.64.4 Maple [A] (verified)
3.5.64.5 Fricas [B] (verification not implemented)
3.5.64.6 Sympy [B] (verification not implemented)
3.5.64.7 Maxima [B] (verification not implemented)
3.5.64.8 Giac [A] (verification not implemented)
3.5.64.9 Mupad [B] (verification not implemented)

3.5.64.1 Optimal result

Integrand size = 25, antiderivative size = 82 \[ \int \frac {(c+d \sin (e+f x))^2}{(3+3 \sin (e+f x))^2} \, dx=\frac {d^2 x}{9}-\frac {(c-d) (c+4 d) \cos (e+f x)}{27 f (1+\sin (e+f x))}-\frac {(c-d) \cos (e+f x) (c+d \sin (e+f x))}{3 f (3+3 \sin (e+f x))^2} \]

output
d^2*x/a^2-1/3*(c-d)*(c+4*d)*cos(f*x+e)/a^2/f/(1+sin(f*x+e))-1/3*(c-d)*cos( 
f*x+e)*(c+d*sin(f*x+e))/f/(a+a*sin(f*x+e))^2
 
3.5.64.2 Mathematica [B] (verified)

Leaf count is larger than twice the leaf count of optimal. \(169\) vs. \(2(82)=164\).

Time = 0.26 (sec) , antiderivative size = 169, normalized size of antiderivative = 2.06 \[ \int \frac {(c+d \sin (e+f x))^2}{(3+3 \sin (e+f x))^2} \, dx=\frac {\left (\cos \left (\frac {1}{2} (e+f x)\right )+\sin \left (\frac {1}{2} (e+f x)\right )\right ) \left (2 (c-d)^2 \sin \left (\frac {1}{2} (e+f x)\right )-(c-d)^2 \left (\cos \left (\frac {1}{2} (e+f x)\right )+\sin \left (\frac {1}{2} (e+f x)\right )\right )+2 \left (c^2+4 c d-5 d^2\right ) \sin \left (\frac {1}{2} (e+f x)\right ) \left (\cos \left (\frac {1}{2} (e+f x)\right )+\sin \left (\frac {1}{2} (e+f x)\right )\right )^2+3 d^2 (e+f x) \left (\cos \left (\frac {1}{2} (e+f x)\right )+\sin \left (\frac {1}{2} (e+f x)\right )\right )^3\right )}{27 f (1+\sin (e+f x))^2} \]

input
Integrate[(c + d*Sin[e + f*x])^2/(3 + 3*Sin[e + f*x])^2,x]
 
output
((Cos[(e + f*x)/2] + Sin[(e + f*x)/2])*(2*(c - d)^2*Sin[(e + f*x)/2] - (c 
- d)^2*(Cos[(e + f*x)/2] + Sin[(e + f*x)/2]) + 2*(c^2 + 4*c*d - 5*d^2)*Sin 
[(e + f*x)/2]*(Cos[(e + f*x)/2] + Sin[(e + f*x)/2])^2 + 3*d^2*(e + f*x)*(C 
os[(e + f*x)/2] + Sin[(e + f*x)/2])^3))/(27*f*(1 + Sin[e + f*x])^2)
 
3.5.64.3 Rubi [A] (verified)

Time = 0.44 (sec) , antiderivative size = 89, normalized size of antiderivative = 1.09, number of steps used = 7, number of rules used = 7, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.280, Rules used = {3042, 3239, 25, 3042, 3214, 3042, 3127}

Below are the steps used by Rubi to obtain the solution. The rule number used for the transformation is given above next to the arrow. The rules definitions used are listed below.

\(\displaystyle \int \frac {(c+d \sin (e+f x))^2}{(a \sin (e+f x)+a)^2} \, dx\)

\(\Big \downarrow \) 3042

\(\displaystyle \int \frac {(c+d \sin (e+f x))^2}{(a \sin (e+f x)+a)^2}dx\)

\(\Big \downarrow \) 3239

\(\displaystyle -\frac {\int -\frac {3 a \sin (e+f x) d^2+a \left (c^2+3 d c-d^2\right )}{\sin (e+f x) a+a}dx}{3 a^2}-\frac {(c-d) \cos (e+f x) (c+d \sin (e+f x))}{3 f (a \sin (e+f x)+a)^2}\)

\(\Big \downarrow \) 25

\(\displaystyle \frac {\int \frac {3 a \sin (e+f x) d^2+a \left (c^2+3 d c-d^2\right )}{\sin (e+f x) a+a}dx}{3 a^2}-\frac {(c-d) \cos (e+f x) (c+d \sin (e+f x))}{3 f (a \sin (e+f x)+a)^2}\)

\(\Big \downarrow \) 3042

\(\displaystyle \frac {\int \frac {3 a \sin (e+f x) d^2+a \left (c^2+3 d c-d^2\right )}{\sin (e+f x) a+a}dx}{3 a^2}-\frac {(c-d) \cos (e+f x) (c+d \sin (e+f x))}{3 f (a \sin (e+f x)+a)^2}\)

\(\Big \downarrow \) 3214

\(\displaystyle \frac {a (c-d) (c+4 d) \int \frac {1}{\sin (e+f x) a+a}dx+3 d^2 x}{3 a^2}-\frac {(c-d) \cos (e+f x) (c+d \sin (e+f x))}{3 f (a \sin (e+f x)+a)^2}\)

\(\Big \downarrow \) 3042

\(\displaystyle \frac {a (c-d) (c+4 d) \int \frac {1}{\sin (e+f x) a+a}dx+3 d^2 x}{3 a^2}-\frac {(c-d) \cos (e+f x) (c+d \sin (e+f x))}{3 f (a \sin (e+f x)+a)^2}\)

\(\Big \downarrow \) 3127

\(\displaystyle \frac {3 d^2 x-\frac {a (c-d) (c+4 d) \cos (e+f x)}{f (a \sin (e+f x)+a)}}{3 a^2}-\frac {(c-d) \cos (e+f x) (c+d \sin (e+f x))}{3 f (a \sin (e+f x)+a)^2}\)

input
Int[(c + d*Sin[e + f*x])^2/(a + a*Sin[e + f*x])^2,x]
 
output
-1/3*((c - d)*Cos[e + f*x]*(c + d*Sin[e + f*x]))/(f*(a + a*Sin[e + f*x])^2 
) + (3*d^2*x - (a*(c - d)*(c + 4*d)*Cos[e + f*x])/(f*(a + a*Sin[e + f*x])) 
)/(3*a^2)
 

3.5.64.3.1 Defintions of rubi rules used

rule 25
Int[-(Fx_), x_Symbol] :> Simp[Identity[-1]   Int[Fx, x], x]
 

rule 3042
Int[u_, x_Symbol] :> Int[DeactivateTrig[u, x], x] /; FunctionOfTrigOfLinear 
Q[u, x]
 

rule 3127
Int[((a_) + (b_.)*sin[(c_.) + (d_.)*(x_)])^(-1), x_Symbol] :> Simp[-Cos[c + 
 d*x]/(d*(b + a*Sin[c + d*x])), x] /; FreeQ[{a, b, c, d}, x] && EqQ[a^2 - b 
^2, 0]
 

rule 3214
Int[((a_.) + (b_.)*sin[(e_.) + (f_.)*(x_)])/((c_.) + (d_.)*sin[(e_.) + (f_. 
)*(x_)]), x_Symbol] :> Simp[b*(x/d), x] - Simp[(b*c - a*d)/d   Int[1/(c + d 
*Sin[e + f*x]), x], x] /; FreeQ[{a, b, c, d, e, f}, x] && NeQ[b*c - a*d, 0]
 

rule 3239
Int[((a_) + (b_.)*sin[(e_.) + (f_.)*(x_)])^(m_)*((c_) + (d_.)*sin[(e_.) + ( 
f_.)*(x_)])^2, x_Symbol] :> Simp[(b*c - a*d)*Cos[e + f*x]*(a + b*Sin[e + f* 
x])^m*((c + d*Sin[e + f*x])/(a*f*(2*m + 1))), x] + Simp[1/(a*b*(2*m + 1)) 
 Int[(a + b*Sin[e + f*x])^(m + 1)*Simp[a*c*d*(m - 1) + b*(d^2 + c^2*(m + 1) 
) + d*(a*d*(m - 1) + b*c*(m + 2))*Sin[e + f*x], x], x], x] /; FreeQ[{a, b, 
c, d, e, f}, x] && NeQ[b*c - a*d, 0] && EqQ[a^2 - b^2, 0] && LtQ[m, -1]
 
3.5.64.4 Maple [A] (verified)

Time = 0.83 (sec) , antiderivative size = 108, normalized size of antiderivative = 1.32

method result size
derivativedivides \(\frac {2 d^{2} \arctan \left (\tan \left (\frac {f x}{2}+\frac {e}{2}\right )\right )-\frac {2 \left (c^{2}-d^{2}\right )}{\tan \left (\frac {f x}{2}+\frac {e}{2}\right )+1}-\frac {-2 c^{2}+4 c d -2 d^{2}}{\left (\tan \left (\frac {f x}{2}+\frac {e}{2}\right )+1\right )^{2}}-\frac {2 \left (2 c^{2}-4 c d +2 d^{2}\right )}{3 \left (\tan \left (\frac {f x}{2}+\frac {e}{2}\right )+1\right )^{3}}}{a^{2} f}\) \(108\)
default \(\frac {2 d^{2} \arctan \left (\tan \left (\frac {f x}{2}+\frac {e}{2}\right )\right )-\frac {2 \left (c^{2}-d^{2}\right )}{\tan \left (\frac {f x}{2}+\frac {e}{2}\right )+1}-\frac {-2 c^{2}+4 c d -2 d^{2}}{\left (\tan \left (\frac {f x}{2}+\frac {e}{2}\right )+1\right )^{2}}-\frac {2 \left (2 c^{2}-4 c d +2 d^{2}\right )}{3 \left (\tan \left (\frac {f x}{2}+\frac {e}{2}\right )+1\right )^{3}}}{a^{2} f}\) \(108\)
risch \(\frac {d^{2} x}{a^{2}}-\frac {2 \left (-c^{2}-4 c d +5 d^{2}+3 i c^{2} {\mathrm e}^{i \left (f x +e \right )}+6 i d \,{\mathrm e}^{i \left (f x +e \right )} c -9 i d^{2} {\mathrm e}^{i \left (f x +e \right )}+6 c d \,{\mathrm e}^{2 i \left (f x +e \right )}-6 d^{2} {\mathrm e}^{2 i \left (f x +e \right )}\right )}{3 f \,a^{2} \left ({\mathrm e}^{i \left (f x +e \right )}+i\right )^{3}}\) \(118\)
parallelrisch \(\frac {3 d^{2} \left (\tan ^{3}\left (\frac {f x}{2}+\frac {e}{2}\right )\right ) x f +\left (\left (9 f x +6\right ) d^{2}-6 c^{2}\right ) \left (\tan ^{2}\left (\frac {f x}{2}+\frac {e}{2}\right )\right )+\left (\left (9 f x +18\right ) d^{2}-12 c d -6 c^{2}\right ) \tan \left (\frac {f x}{2}+\frac {e}{2}\right )+\left (3 f x +8\right ) d^{2}-4 c d -4 c^{2}}{3 f \,a^{2} \left (\tan \left (\frac {f x}{2}+\frac {e}{2}\right )+1\right )^{3}}\) \(118\)
norman \(\frac {\frac {d^{2} x}{a}+\frac {d^{2} x \left (\tan ^{7}\left (\frac {f x}{2}+\frac {e}{2}\right )\right )}{a}+\frac {\left (-2 c^{2}+2 d^{2}\right ) \left (\tan ^{6}\left (\frac {f x}{2}+\frac {e}{2}\right )\right )}{f a}+\frac {\left (-2 c^{2}-4 c d +6 d^{2}\right ) \tan \left (\frac {f x}{2}+\frac {e}{2}\right )}{f a}+\frac {\left (-2 c^{2}-4 c d +6 d^{2}\right ) \left (\tan ^{5}\left (\frac {f x}{2}+\frac {e}{2}\right )\right )}{f a}+\frac {\left (-4 c^{2}-8 c d +12 d^{2}\right ) \left (\tan ^{3}\left (\frac {f x}{2}+\frac {e}{2}\right )\right )}{f a}+\frac {-4 c^{2}-4 c d +8 d^{2}}{3 f a}+\frac {3 d^{2} x \tan \left (\frac {f x}{2}+\frac {e}{2}\right )}{a}+\frac {5 d^{2} x \left (\tan ^{2}\left (\frac {f x}{2}+\frac {e}{2}\right )\right )}{a}+\frac {7 d^{2} x \left (\tan ^{3}\left (\frac {f x}{2}+\frac {e}{2}\right )\right )}{a}+\frac {7 d^{2} x \left (\tan ^{4}\left (\frac {f x}{2}+\frac {e}{2}\right )\right )}{a}+\frac {5 d^{2} x \left (\tan ^{5}\left (\frac {f x}{2}+\frac {e}{2}\right )\right )}{a}+\frac {3 d^{2} x \left (\tan ^{6}\left (\frac {f x}{2}+\frac {e}{2}\right )\right )}{a}+\frac {\left (-14 c^{2}-8 c d +22 d^{2}\right ) \left (\tan ^{2}\left (\frac {f x}{2}+\frac {e}{2}\right )\right )}{3 f a}+\frac {\left (-16 c^{2}-4 c d +20 d^{2}\right ) \left (\tan ^{4}\left (\frac {f x}{2}+\frac {e}{2}\right )\right )}{3 f a}}{\left (1+\tan ^{2}\left (\frac {f x}{2}+\frac {e}{2}\right )\right )^{2} a \left (\tan \left (\frac {f x}{2}+\frac {e}{2}\right )+1\right )^{3}}\) \(396\)

input
int((c+d*sin(f*x+e))^2/(a+a*sin(f*x+e))^2,x,method=_RETURNVERBOSE)
 
output
2/f/a^2*(d^2*arctan(tan(1/2*f*x+1/2*e))-(c^2-d^2)/(tan(1/2*f*x+1/2*e)+1)-1 
/2*(-2*c^2+4*c*d-2*d^2)/(tan(1/2*f*x+1/2*e)+1)^2-1/3*(2*c^2-4*c*d+2*d^2)/( 
tan(1/2*f*x+1/2*e)+1)^3)
 
3.5.64.5 Fricas [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 197 vs. \(2 (81) = 162\).

Time = 0.27 (sec) , antiderivative size = 197, normalized size of antiderivative = 2.40 \[ \int \frac {(c+d \sin (e+f x))^2}{(3+3 \sin (e+f x))^2} \, dx=-\frac {6 \, d^{2} f x - {\left (3 \, d^{2} f x + c^{2} + 4 \, c d - 5 \, d^{2}\right )} \cos \left (f x + e\right )^{2} - c^{2} + 2 \, c d - d^{2} + {\left (3 \, d^{2} f x - 2 \, c^{2} - 2 \, c d + 4 \, d^{2}\right )} \cos \left (f x + e\right ) + {\left (6 \, d^{2} f x + c^{2} - 2 \, c d + d^{2} + {\left (3 \, d^{2} f x - c^{2} - 4 \, c d + 5 \, d^{2}\right )} \cos \left (f x + e\right )\right )} \sin \left (f x + e\right )}{3 \, {\left (a^{2} f \cos \left (f x + e\right )^{2} - a^{2} f \cos \left (f x + e\right ) - 2 \, a^{2} f - {\left (a^{2} f \cos \left (f x + e\right ) + 2 \, a^{2} f\right )} \sin \left (f x + e\right )\right )}} \]

input
integrate((c+d*sin(f*x+e))^2/(a+a*sin(f*x+e))^2,x, algorithm="fricas")
 
output
-1/3*(6*d^2*f*x - (3*d^2*f*x + c^2 + 4*c*d - 5*d^2)*cos(f*x + e)^2 - c^2 + 
 2*c*d - d^2 + (3*d^2*f*x - 2*c^2 - 2*c*d + 4*d^2)*cos(f*x + e) + (6*d^2*f 
*x + c^2 - 2*c*d + d^2 + (3*d^2*f*x - c^2 - 4*c*d + 5*d^2)*cos(f*x + e))*s 
in(f*x + e))/(a^2*f*cos(f*x + e)^2 - a^2*f*cos(f*x + e) - 2*a^2*f - (a^2*f 
*cos(f*x + e) + 2*a^2*f)*sin(f*x + e))
 
3.5.64.6 Sympy [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 915 vs. \(2 (76) = 152\).

Time = 2.21 (sec) , antiderivative size = 915, normalized size of antiderivative = 11.16 \[ \int \frac {(c+d \sin (e+f x))^2}{(3+3 \sin (e+f x))^2} \, dx=\text {Too large to display} \]

input
integrate((c+d*sin(f*x+e))**2/(a+a*sin(f*x+e))**2,x)
 
output
Piecewise((-6*c**2*tan(e/2 + f*x/2)**2/(3*a**2*f*tan(e/2 + f*x/2)**3 + 9*a 
**2*f*tan(e/2 + f*x/2)**2 + 9*a**2*f*tan(e/2 + f*x/2) + 3*a**2*f) - 6*c**2 
*tan(e/2 + f*x/2)/(3*a**2*f*tan(e/2 + f*x/2)**3 + 9*a**2*f*tan(e/2 + f*x/2 
)**2 + 9*a**2*f*tan(e/2 + f*x/2) + 3*a**2*f) - 4*c**2/(3*a**2*f*tan(e/2 + 
f*x/2)**3 + 9*a**2*f*tan(e/2 + f*x/2)**2 + 9*a**2*f*tan(e/2 + f*x/2) + 3*a 
**2*f) - 12*c*d*tan(e/2 + f*x/2)/(3*a**2*f*tan(e/2 + f*x/2)**3 + 9*a**2*f* 
tan(e/2 + f*x/2)**2 + 9*a**2*f*tan(e/2 + f*x/2) + 3*a**2*f) - 4*c*d/(3*a** 
2*f*tan(e/2 + f*x/2)**3 + 9*a**2*f*tan(e/2 + f*x/2)**2 + 9*a**2*f*tan(e/2 
+ f*x/2) + 3*a**2*f) + 3*d**2*f*x*tan(e/2 + f*x/2)**3/(3*a**2*f*tan(e/2 + 
f*x/2)**3 + 9*a**2*f*tan(e/2 + f*x/2)**2 + 9*a**2*f*tan(e/2 + f*x/2) + 3*a 
**2*f) + 9*d**2*f*x*tan(e/2 + f*x/2)**2/(3*a**2*f*tan(e/2 + f*x/2)**3 + 9* 
a**2*f*tan(e/2 + f*x/2)**2 + 9*a**2*f*tan(e/2 + f*x/2) + 3*a**2*f) + 9*d** 
2*f*x*tan(e/2 + f*x/2)/(3*a**2*f*tan(e/2 + f*x/2)**3 + 9*a**2*f*tan(e/2 + 
f*x/2)**2 + 9*a**2*f*tan(e/2 + f*x/2) + 3*a**2*f) + 3*d**2*f*x/(3*a**2*f*t 
an(e/2 + f*x/2)**3 + 9*a**2*f*tan(e/2 + f*x/2)**2 + 9*a**2*f*tan(e/2 + f*x 
/2) + 3*a**2*f) + 6*d**2*tan(e/2 + f*x/2)**2/(3*a**2*f*tan(e/2 + f*x/2)**3 
 + 9*a**2*f*tan(e/2 + f*x/2)**2 + 9*a**2*f*tan(e/2 + f*x/2) + 3*a**2*f) + 
18*d**2*tan(e/2 + f*x/2)/(3*a**2*f*tan(e/2 + f*x/2)**3 + 9*a**2*f*tan(e/2 
+ f*x/2)**2 + 9*a**2*f*tan(e/2 + f*x/2) + 3*a**2*f) + 8*d**2/(3*a**2*f*tan 
(e/2 + f*x/2)**3 + 9*a**2*f*tan(e/2 + f*x/2)**2 + 9*a**2*f*tan(e/2 + f*...
 
3.5.64.7 Maxima [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 360 vs. \(2 (81) = 162\).

Time = 0.29 (sec) , antiderivative size = 360, normalized size of antiderivative = 4.39 \[ \int \frac {(c+d \sin (e+f x))^2}{(3+3 \sin (e+f x))^2} \, dx=\frac {2 \, {\left (d^{2} {\left (\frac {\frac {9 \, \sin \left (f x + e\right )}{\cos \left (f x + e\right ) + 1} + \frac {3 \, \sin \left (f x + e\right )^{2}}{{\left (\cos \left (f x + e\right ) + 1\right )}^{2}} + 4}{a^{2} + \frac {3 \, a^{2} \sin \left (f x + e\right )}{\cos \left (f x + e\right ) + 1} + \frac {3 \, a^{2} \sin \left (f x + e\right )^{2}}{{\left (\cos \left (f x + e\right ) + 1\right )}^{2}} + \frac {a^{2} \sin \left (f x + e\right )^{3}}{{\left (\cos \left (f x + e\right ) + 1\right )}^{3}}} + \frac {3 \, \arctan \left (\frac {\sin \left (f x + e\right )}{\cos \left (f x + e\right ) + 1}\right )}{a^{2}}\right )} - \frac {c^{2} {\left (\frac {3 \, \sin \left (f x + e\right )}{\cos \left (f x + e\right ) + 1} + \frac {3 \, \sin \left (f x + e\right )^{2}}{{\left (\cos \left (f x + e\right ) + 1\right )}^{2}} + 2\right )}}{a^{2} + \frac {3 \, a^{2} \sin \left (f x + e\right )}{\cos \left (f x + e\right ) + 1} + \frac {3 \, a^{2} \sin \left (f x + e\right )^{2}}{{\left (\cos \left (f x + e\right ) + 1\right )}^{2}} + \frac {a^{2} \sin \left (f x + e\right )^{3}}{{\left (\cos \left (f x + e\right ) + 1\right )}^{3}}} - \frac {2 \, c d {\left (\frac {3 \, \sin \left (f x + e\right )}{\cos \left (f x + e\right ) + 1} + 1\right )}}{a^{2} + \frac {3 \, a^{2} \sin \left (f x + e\right )}{\cos \left (f x + e\right ) + 1} + \frac {3 \, a^{2} \sin \left (f x + e\right )^{2}}{{\left (\cos \left (f x + e\right ) + 1\right )}^{2}} + \frac {a^{2} \sin \left (f x + e\right )^{3}}{{\left (\cos \left (f x + e\right ) + 1\right )}^{3}}}\right )}}{3 \, f} \]

input
integrate((c+d*sin(f*x+e))^2/(a+a*sin(f*x+e))^2,x, algorithm="maxima")
 
output
2/3*(d^2*((9*sin(f*x + e)/(cos(f*x + e) + 1) + 3*sin(f*x + e)^2/(cos(f*x + 
 e) + 1)^2 + 4)/(a^2 + 3*a^2*sin(f*x + e)/(cos(f*x + e) + 1) + 3*a^2*sin(f 
*x + e)^2/(cos(f*x + e) + 1)^2 + a^2*sin(f*x + e)^3/(cos(f*x + e) + 1)^3) 
+ 3*arctan(sin(f*x + e)/(cos(f*x + e) + 1))/a^2) - c^2*(3*sin(f*x + e)/(co 
s(f*x + e) + 1) + 3*sin(f*x + e)^2/(cos(f*x + e) + 1)^2 + 2)/(a^2 + 3*a^2* 
sin(f*x + e)/(cos(f*x + e) + 1) + 3*a^2*sin(f*x + e)^2/(cos(f*x + e) + 1)^ 
2 + a^2*sin(f*x + e)^3/(cos(f*x + e) + 1)^3) - 2*c*d*(3*sin(f*x + e)/(cos( 
f*x + e) + 1) + 1)/(a^2 + 3*a^2*sin(f*x + e)/(cos(f*x + e) + 1) + 3*a^2*si 
n(f*x + e)^2/(cos(f*x + e) + 1)^2 + a^2*sin(f*x + e)^3/(cos(f*x + e) + 1)^ 
3))/f
 
3.5.64.8 Giac [A] (verification not implemented)

Time = 0.46 (sec) , antiderivative size = 125, normalized size of antiderivative = 1.52 \[ \int \frac {(c+d \sin (e+f x))^2}{(3+3 \sin (e+f x))^2} \, dx=\frac {\frac {3 \, {\left (f x + e\right )} d^{2}}{a^{2}} - \frac {2 \, {\left (3 \, c^{2} \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )^{2} - 3 \, d^{2} \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )^{2} + 3 \, c^{2} \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right ) + 6 \, c d \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right ) - 9 \, d^{2} \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right ) + 2 \, c^{2} + 2 \, c d - 4 \, d^{2}\right )}}{a^{2} {\left (\tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right ) + 1\right )}^{3}}}{3 \, f} \]

input
integrate((c+d*sin(f*x+e))^2/(a+a*sin(f*x+e))^2,x, algorithm="giac")
 
output
1/3*(3*(f*x + e)*d^2/a^2 - 2*(3*c^2*tan(1/2*f*x + 1/2*e)^2 - 3*d^2*tan(1/2 
*f*x + 1/2*e)^2 + 3*c^2*tan(1/2*f*x + 1/2*e) + 6*c*d*tan(1/2*f*x + 1/2*e) 
- 9*d^2*tan(1/2*f*x + 1/2*e) + 2*c^2 + 2*c*d - 4*d^2)/(a^2*(tan(1/2*f*x + 
1/2*e) + 1)^3))/f
 
3.5.64.9 Mupad [B] (verification not implemented)

Time = 7.36 (sec) , antiderivative size = 93, normalized size of antiderivative = 1.13 \[ \int \frac {(c+d \sin (e+f x))^2}{(3+3 \sin (e+f x))^2} \, dx=\frac {d^2\,x}{a^2}-\frac {\frac {4\,c\,d}{3}+{\mathrm {tan}\left (\frac {e}{2}+\frac {f\,x}{2}\right )}^2\,\left (2\,c^2-2\,d^2\right )+\frac {4\,c^2}{3}-\frac {8\,d^2}{3}+\mathrm {tan}\left (\frac {e}{2}+\frac {f\,x}{2}\right )\,\left (2\,c^2+4\,c\,d-6\,d^2\right )}{a^2\,f\,{\left (\mathrm {tan}\left (\frac {e}{2}+\frac {f\,x}{2}\right )+1\right )}^3} \]

input
int((c + d*sin(e + f*x))^2/(a + a*sin(e + f*x))^2,x)
 
output
(d^2*x)/a^2 - ((4*c*d)/3 + tan(e/2 + (f*x)/2)^2*(2*c^2 - 2*d^2) + (4*c^2)/ 
3 - (8*d^2)/3 + tan(e/2 + (f*x)/2)*(4*c*d + 2*c^2 - 6*d^2))/(a^2*f*(tan(e/ 
2 + (f*x)/2) + 1)^3)